#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<conio.h>
typedef struct jie
{
	char n;
	int i;
	jie * next;
}dian;

dian * init()
{
	dian * a=NULL;
	a=(dian *)malloc(sizeof(dian));
	a->n ='0';
	a->i =0;
	a->next =NULL;
	return a;
}
dian * wd(dian * p)
{
	dian * a=p;
	while(a->next !=NULL)
		a=a->next ;
	return a;
}
char wn(dian * p)
{
	dian * a=wd(p);
	return a->n ;
}
int wi(dian * p)
{
	dian * a=wd(p);
	return a->i ;
}
dian * wwd(dian * p)
{
	dian * a=wd(p);
	dian * b=p;
	while(b->next !=a)
		b=b->next ;
	return b;
}
void jia(dian * p,char x)
{
	dian * a=init();
	a->n =x;
	a->i =wi(p)+1;
	dian * b=wd(p);
	b->next =a;
}
void shan(dian * p)
{
	dian * a=wd(p);
	dian * b=wwd(p);
	b->next =NULL;
	free(a);
}
int pr(char x)
{
	if(x=='*'||x=='/')
		return 4;
	else if(x=='+'||x=='-')
		return 3;
	else if(x=='(')
		return 2;
	else if(x=='#')
		return 1;
	else
		return 0;
}
void main()
{
	dian * p=init();
	jia(p,'#');
	char s[20],h[20];
	scanf("%s",s);
	int n=strlen(s);
	s[n]='#';
	s[n+1]='\0';
	int i=0,k=0;
	char x;
	while(s[i]!='\0')
	{
		if(s[i]>='0'&&s[i]<='9')
		{
			h[k++]=s[i++];
		}
		else
		switch(s[i])
		{
		case'(':
			{
				jia(p,s[i++]);
				break;
			}
		case')':
			{
				x=wn(p);
				shan(p);
				while(x!='(')
				{
					h[k++]=x;
					x=wn(p);
					shan(p);
				}
				i++;
				break;
			}
		default:
			{
				x=wn(p);
				while(pr(x)>=pr(s[i]))
				{
					h[k++]=x;
					shan(p);
					x=wn(p);
				}
				if(s[i]!='#')
					jia(p,s[i]);
				i++;
			}
		}
	}
	h[k]='\0';
	printf("%s",h);
	getch();
}
